1. Field of the Invention
The present invention relates to image generating apparatuses and image generating programs and, more specifically, to an image generating apparatus for generating an image representing a submerged land portion and others in a game world in virtual three-dimensional space, and an image generating program executed on the apparatus.
2. Description of the Background Art
Conventionally, a game machine, which is one example of computer-equipped image generating apparatuses, may display an image of a state of a land submerged in water when viewed from the water surface in a game world in virtual three-dimensional space.
Such image is generally generated by the following scheme. First, a land object formed by polygons is placed on a world coordinate system of virtual three-dimensional space. On a submerged area of the land object, a water surface object formed by polygons is placed. Next, the land object, the water surface object, and others are transformed into a camera coordinate system based on a virtual camera set outside the water surface, and subjected to clipping and hidden surface processing. Furthermore, a land texture pasted on each polygon of the land object and a water surface texture pasted on each polygon of the water surface object are respectively determined. Then, the textures corresponding to the respective polygons projected onto a virtual two-dimensional plane are rendered in the frame buffer based on a Z buffer or the like, thereby generating an image including a submerged land, for example ((a) of FIG. 6). Particularly in the submerged land portion in this image, an image is generated so that the land texture is translucently overlaid with the water surface texture.
However, in the above conventional scheme, the image of the submerged land portion is processed simply by a hardware""s rendering function, and generated by combining each color data (R, G, B) of the land texture and the water surface texture at an equal ratio (for example, 30%:70%, or the like). That is, in the conventional scheme, the image of the submerged land portion is generated simply by mixing the color data of the water surface texture with the color data of the land texture. Therefore, one problem is that the image gives an impression totally different from that given when the submerged land or the like is viewed in the real world, lacking reality.
Also, to improve reality of the image, the land texture of the submerged portion of the land is prepared in advance separately from the land texture of the unsubmerged portions ((b) of FIG. 6). However, although preparation, in advance, of the land texture rendered with a different texture only for the submerged portion improves reality, the number of textures used in the game world is increased, thereby causing various problems such as complexity in texture generation at game development stage, and allocation of an area for storing the textures. Furthermore, another problem is that, in a case where such land texture as prepared in advance is used, when the water level is changed in the game world, for example, when the land portion first submerged in water then emerges above the water surface, a clear boundary line of the land texture appears ((c) of FIG. 6).
Therefore, an object of the present invention is to provide an image generating apparatus and an image generating program capable of generating an image realistically representing a submerged object (land portion or others) by changing a land texture in each color data at a predetermined ratio in consideration of water characteristics, and combining the land texture in a water surface texture.
The present invention has the following features to attain the object above.
A first aspect of the present invention is directed to an image generating apparatus that generates, in a frame buffer, an image representing an object placed in water as viewed from a water surface in virtual space. The apparatus includes image storage means (correspondence with the embodiment: memory 13, for example), first rendering means (main processor 11 and/or coprocessor 12, for example), color information reading means (main processor 11 and/or coprocessor 12, for example), color information changing means (main processor 11 and/or coprocessor 12, for example), color information generating means (main processor 11 and/or coprocessor 12, for example), and second rendering means (main processor 11 and/or coprocessor 12, for example).
The image storage means stores a water surface image for representing the water surface, and an object image for representing an object existing in the virtual space. The first rendering means renders, in the frame buffer, the object image read from the image storage means. The color information reading means reads, from the frame buffer, pixel-by-pixel color information (for example, VR, VG, VB, of RGB color components) of the object image corresponding to an area where the water surface image is rendered. The color information changing means reduces color component values included in the pixel-by-pixel color information read from the color information reading means so that a ratio of reducing a red color component value (VR) becomes larger than a ratio of reducing a blue color component value (VB) and a ratio of reducing a green color component value (VG). The color information generating means generates new pixel-by-pixel color information (NR, NG, NB) by mixing the pixel-by-pixel color information with each of the color component values reduced (VRxe2x80x2, VGxe2x80x2, VBxe2x80x2) and pixel-by-pixel color information of the water surface image (WR, WG, WB) at a predetermined ratio ((1xe2x88x92xcex2):xcex2) with translucent processing. The second rendering means re-renders in the frame buffer the new pixel-by-pixel color information generated in the color information generating means.
As described above, in the first aspect, an object image providing a base such as a land is so processed in advance before translucently overlaid with a water surface image as that the red color component value included in the color data of the object image of a portion overlaid with the water surface image is reduced at a ratio larger than that used for the other color component values. Thus, the object image such as a submerged land translucently overlaid with the water surface image can be displayed more realistically than ever.
Here, preferably, the color information changing means changes at least the ratio of reducing the red color component value according to transmittancy and/or reflectivity of water in the virtual space. Alternatively, the color information changing means changes at least the ratio of reducing the red color component value according to a depth from the water surface to the object in water in the virtual space.
As such, the ratio of reducing the red color component value is changed according to the transmittancy and/or reflectivity of water, the depth from the water surface to the object, or others, thereby enabling realistic display according to the state of water in virtual space. Specifically, if the change is made according to the depth, the red color component can be made smaller for the texture of a land located at a position deeper from the water surface. Therefore, more realistic display can be made.
Also, preferably, parameter storage means (memory 13, for example) is further provided for storing a blue color parameter (xcex1b) according to the ratio of reducing the blue color component value, a green color parameter (xcex1g) according to the ratio of reducing the green color component value, and a red color parameter (xcex1r) according to the ratio of reducing the red color component value, the red color parameter smaller than the blue color and green color parameters, and
the color information changing means multiplies the blue color component value by the blue color parameter, the green color component value by the green color parameter, and the red color component value by the red color parameter for reducing each of the color component values.
As such, by storing in advance parameters according to the ratios of reducing the respective color component values, the respective color component values are easily changed according to various states in virtual space.
A second aspect of the present invention is directed to an image generating program for making a computer (structured by main processor 11, coprocessor 12, memory 13, and others, for example) execute a procedure of generating, in a frame buffer, an image representing an object placed in water as viewed from a water surface in virtual space, the program making the computer execute a first image rendering step (S60, S61, for example), a color information reading step (S55, for example), a color information reducing step (S56, for example), color information generating step (S57, S58, for example), and a second image rendering step (S59, for example).
In the first image rendering step, an object image for representing an object existing in the virtual space is rendered in the frame buffer. In the color information reading step, pixel-by-pixel color information (VR, VG, VB) of the object image corresponding to an area where a water surface image for representing the water surface is rendered is read from the frame buffer. In the color information reducing step, color component values included in the read pixel-by-pixel color information is reduced so that a ratio of reducing a red color component value (VR) becomes larger than a ratio of reducing a blue color component value (VB) and a ratio of reducing a green color component value (VG). In the color information generating step, new pixel-by-pixel color information (NR, NG, NB) is generated by mixing the pixel-by-pixel color information with each of the color component values reduced (VRxe2x80x2, VGxe2x80x2, VBxe2x80x2) and pixel-by-pixel color information of the water surface image (WR, WG, WB) at a predetermined ratio ((1xe2x88x92xcex2):xcex2) with translucent processing. In a second rendering step, the generated new pixel-by-pixel color information is re-rendered in the frame buffer.
Here, preferably, the color information reducing step changes at least the ratio of reducing the red color component value according to transmittancy and/or reflectivity of water in the virtual space. Alternatively, the color information reducing step changes at least the ratio of reducing the red color component value according to a depth from the water surface to the object in water in the virtual space.
By introducing such image generating program into the computer for execution, it is possible to realize the image generating apparatus in the first aspect achieving the above effects.
These and other objects, features, aspects and advantages of the present invention will become more apparent from the following detailed description of the present invention when taken in conjunction with the accompanying drawings.